package com.tzpay.tzpay.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by chenfeiyue on 16/3/8.
 */
public class FunctionInfoWrapper implements Parcelable {

    /**
     * funcId :
     * funcName : 分类查询
     * isVisible : true
     * type : func
     * clickUrl : http://m.jd.com/category/all.html
     * image : http://m.360buyimg.com/mobilecms/s80x80_jfs/t2275/267/2109565733/4908/6f42753f/56be05dcN94355bd6.png
     * banners :
     */

    private ArrayList<ItemsEntity> items;

    public void setItems(ArrayList<ItemsEntity> items) {
        this.items = items;
    }

    public ArrayList<ItemsEntity> getItems() {
        return items;
    }

    public static class ItemsEntity {
        private String funcId;
        private String funcName;
        private boolean isVisible;
        private String type;
        private String clickUrl;
        private String image;
        private ArrayList<BannersEntity> banners;

        public void setFuncId(String funcId) {
            this.funcId = funcId;
        }

        public void setFuncName(String funcName) {
            this.funcName = funcName;
        }

        public void setIsVisible(boolean isVisible) {
            this.isVisible = isVisible;
        }

        public void setType(String type) {
            this.type = type;
        }

        public void setClickUrl(String clickUrl) {
            this.clickUrl = clickUrl;
        }

        public void setImage(String image) {
            this.image = image;
        }

        public String getFuncId() {
            return funcId;
        }

        public String getFuncName() {
            return funcName;
        }

        public boolean isIsVisible() {
            return isVisible;
        }

        public String getType() {
            return type;
        }

        public String getClickUrl() {
            return clickUrl;
        }

        public String getImage() {
            return image;
        }

        public ArrayList<BannersEntity> getBanners() {
            return banners;
        }

        public void setBanners(ArrayList<BannersEntity> banners) {
            this.banners = banners;
        }

        public static class BannersEntity implements Parcelable {
            private String funcId;
            private String funcName;
            private boolean isVisible;
            private String type;
            private String clickUrl;
            private String image;

            public void setFuncId(String funcId) {
                this.funcId = funcId;
            }

            public void setFuncName(String funcName) {
                this.funcName = funcName;
            }

            public void setIsVisible(boolean isVisible) {
                this.isVisible = isVisible;
            }

            public void setType(String type) {
                this.type = type;
            }

            public void setClickUrl(String clickUrl) {
                this.clickUrl = clickUrl;
            }

            public void setImage(String image) {
                this.image = image;
            }

            public String getFuncId() {
                return funcId;
            }

            public String getFuncName() {
                return funcName;
            }

            public boolean isIsVisible() {
                return isVisible;
            }

            public String getType() {
                return type;
            }

            public String getClickUrl() {
                return clickUrl;
            }

            public String getImage() {
                return image;
            }

            @Override
            public String toString() {
                return "BannersEntity{" +
                        "funcId='" + funcId + '\'' +
                        ", funcName='" + funcName + '\'' +
                        ", isVisible=" + isVisible +
                        ", type='" + type + '\'' +
                        ", clickUrl='" + clickUrl + '\'' +
                        ", image='" + image + '\'' +
                        '}';
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(this.funcId);
                dest.writeString(this.funcName);
                dest.writeByte(isVisible ? (byte) 1 : (byte) 0);
                dest.writeString(this.type);
                dest.writeString(this.clickUrl);
                dest.writeString(this.image);
            }

            public BannersEntity() {
            }

            protected BannersEntity(Parcel in) {
                this.funcId = in.readString();
                this.funcName = in.readString();
                this.isVisible = in.readByte() != 0;
                this.type = in.readString();
                this.clickUrl = in.readString();
                this.image = in.readString();
            }

            public static final Creator<BannersEntity> CREATOR = new Creator<BannersEntity>() {
                public BannersEntity createFromParcel(Parcel source) {
                    return new BannersEntity(source);
                }

                public BannersEntity[] newArray(int size) {
                    return new BannersEntity[size];
                }
            };
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.items);
    }

    public FunctionInfoWrapper() {
    }

    protected FunctionInfoWrapper(Parcel in) {
        this.items = new ArrayList<ItemsEntity>();
        in.readList(this.items, List.class.getClassLoader());
    }

    public static final Parcelable.Creator<FunctionInfoWrapper> CREATOR = new Parcelable.Creator<FunctionInfoWrapper>() {
        public FunctionInfoWrapper createFromParcel(Parcel source) {
            return new FunctionInfoWrapper(source);
        }

        public FunctionInfoWrapper[] newArray(int size) {
            return new FunctionInfoWrapper[size];
        }
    };
}
